$(document).ready(function () {
  $('form[name="view_message"]').on("submit", function (e) {
    e.preventDefault();

    $.ajax({
      url: "/message/view",
      method: "POST",
      data: $(this).serialize(),
      success: function (res) {
        if (res.status === "success") {
          window.close();
        }
      },
    });
  });
});
